package com.ibm.ops.domain.report;

import com.ibm.ops.OpstoolConstant;
import com.ibm.ops.domain.OpsLogMetaDataType;
import com.ibm.ops.domain.metadata.OpsAuditLogFODSEodReportMetaData;
import com.ibm.ops.domain.metadata.OpsAuditLogReportMetaData;

public class OpsAuditLogFODSEodReport extends OpsAuditLogReport {

	@Override
	protected OpsAuditLogReportMetaData constructOpsAuditLogReportMetaData(String metaData) {
		OpsAuditLogFODSEodReportMetaData fodseodMetaData = new OpsAuditLogFODSEodReportMetaData();
		fodseodMetaData.setType(OpsLogMetaDataType.FODS_EOD);
		fodseodMetaData.setSap_docnum(this.retrieveData(metaData,OpstoolConstant.FODS_EOD_REPORT_SAP_DOC_NUM_START_IX,OpstoolConstant.FODS_EOD_REPORT_SAP_DOC_NUM_START_IX + OpstoolConstant.FODS_EOD_REPORT_SAP_DOC_NUM_LENGTH));
//		fodseodMetaData.setGeo_key(this.retrieveData(metaData,OpstoolConstant.FODS_REJECT_REPORT_GEO_KEY_START_IX,OpstoolConstant.FODS_REJECT_REPORT_GEO_KEY_START_IX + OpstoolConstant.FODS_REJECT_REPORT_GEO_KEY_LENGTH));
		fodseodMetaData.setSerial_number(this.retrieveData(metaData, OpstoolConstant.FODS_EOD_REPORT_SERIAL_NUMBER_START_IX, OpstoolConstant.FODS_EOD_REPORT_SERIAL_NUMBER_START_IX + OpstoolConstant.FODS_EOD_REPORT_SERIAL_NUMBER_LENGTH));
		fodseodMetaData.setSndprn(this.retrieveData(metaData, OpstoolConstant.FODS_EOD_REPORT_SNDPRN_START_IX, OpstoolConstant.FODS_EOD_REPORT_SNDPRN_START_IX + OpstoolConstant.FODS_EOD_REPORT_SNDPRN_LENGTH));
		fodseodMetaData.setTimestamp(this.retrieveData(metaData, OpstoolConstant.FODS_EOD_REPORT_TIME_STAMP_START_IX, OpstoolConstant.FODS_EOD_REPORT_TIME_STAMP_START_IX + OpstoolConstant.FODS_EOD_REPORT_TIME_STAMP_LENGTH));
		this.currentMetaData = fodseodMetaData;
		return fodseodMetaData;
	}

	@Override
	protected OpsAuditLogReportMetaDataKey retrieveOpsAuditLogReportMetaDataKey(String metaData) {
		String key = null;
		if(this.currentMetaData != null){
			if(this.currentMetaData instanceof OpsAuditLogFODSEodReportMetaData){
				OpsAuditLogFODSEodReportMetaData obj = ((OpsAuditLogFODSEodReportMetaData) this.currentMetaData);
				key = obj.getTimestamp();
			}			
		}else{
			key = this.retrieveData(metaData, OpstoolConstant.FODS_EOD_REPORT_TIME_STAMP_START_IX, OpstoolConstant.FODS_EOD_REPORT_TIME_STAMP_START_IX + OpstoolConstant.FODS_EOD_REPORT_TIME_STAMP_LENGTH);
		}
		return new OpsAuditLogReportMetaDataKey(key);
	}

}
